package com.lanjian.idbank.controller;

import com.lanjian.idbank.pojo.BankEntity;
import com.lanjian.idbank.service.BankService;
import com.lanjian.idbank.utils.RealBankCardAuthentication;
import com.lanjian.idbank.pojo.BankEntity;
import com.lanjian.modelo.result.Result;
import com.lanjian.modelo.result.ResultObject;
import com.lanjian.modelo.vo.BankVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Description: new java files header..
 * 银行控制层
 * @author 兰剑
 * @version 1.0
 * @date 2023/3/27 15:30
 */
@RestController
@RequestMapping("/bank")
public class BankController {

    @Autowired
    private BankService bankService;


    /**@Description: 查询银行卡列表
     * @param bankVo
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/3/28 10:31
     */
    @PostMapping("/findBank")
    public Map<String,Object> findBank(@RequestBody BankVo bankVo){
        return bankService.findBank(bankVo);
    }


    /**@Description: 添加银行卡
     * @param bankVo
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/3/28 10:33
     */
    @PostMapping("/addBank")
    public Result addBank(@RequestBody BankVo bankVo){
        return bankService.addBank(bankVo);
    }

    /**@Description: 删除银行卡
     * @param bid
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/3/28 10:34
     */
    @PostMapping("/delBank")
    public Result delBank(@RequestParam("bid") Integer bid){
        return bankService.delBank(bid);
    }

    /**@Description: 修改银行卡
     * @param bankVo
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/3/28 10:34
     */
    @PostMapping("/delBank")
    public Result updateBank(@RequestBody BankVo bankVo){
        return bankService.updateBank(bankVo);
    }


    /**@Description: 移除展示银行卡（逻辑删除）
     * @param bankVo
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/3/28 10:34
     */
    @PostMapping("/delBank")
    public Result isDelBank(@RequestBody BankVo bankVo){
        return bankService.isDelBank(bankVo);
    }

    /**@Description: 绑定银行卡
     * @param bankVo
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/3/28 10:36
     */
    public ResultObject<BankEntity> bindingBank(@RequestBody BankVo bankVo){
        return bankService.bindingBank(bankVo);
    }

    /**@Description: 解除绑定
     * @param bankVo
     * @return
     * @version v1.0
     * @author 兰剑
     * @date 2023/3/28 10:42
     */
    @PostMapping("/removeBank")
    public Result removeBank(@RequestBody BankVo bankVo){
        return bankService.removeBank(bankVo);
    }


}
